/**
 * OSS is a Open Service Container which gives the leverage of building the Desktop and Web
 * Application. * Copyright (C) 2008-2009  Ponraj Sutanthiramani
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Or5e Open Source Community
 * Navigator Bldg, ITPL, Bangalore, India.
 */

package org.or5e.api.calendar;

import java.io.File;
import java.util.LinkedList;
import java.util.List;
import org.or5e.core.BaseObject;

/**
 * @author Ponraj Suthanthriamani
 */
public abstract class DataFileLoader extends BaseObject {
    private File loadFile;
    private String type;

    public File getLoadFile() {
        return loadFile;
    }

    public void setLoadFile(File loadFile) {
        this.loadFile = loadFile;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }
    
    public List<CalendarEntry> loadEntry() {
        initilize();
        List<CalendarEntry> loadEntry = new LinkedList<CalendarEntry>();
        CalendarEntry entry = getNextEntry();
        while(entry != null) {
            loadEntry.add(entry);
            entry = getNextEntry();
        }
        return loadEntry;
    }
    public abstract boolean initilize();
    public abstract CalendarEntry getNextEntry();
}